'\" te
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH CURS_ADDCH 3CURSES "Dec 31, 1996"
.SH NAME
curs_addch, addch, waddch, mvaddch, mvwaddch, echochar, wechochar \- add a
character (with attributes) to a curses window and advance cursor
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lcurses\fR [ \fIlibrary\fR .. ]
#include <curses.h>

\fBint\fR \fBaddch\fR(\fBchtype\fR \fIch\fR);
.fi

.LP
.nf
\fBint\fR \fBwaddch\fR(\fBWINDOW *\fR\fIwin\fR, \fBchtype\fR \fIch\fR);
.fi

.LP
.nf
\fBint\fR \fBmvaddch\fR(\fBint\fR \fIy\fR, \fBint\fR \fIx\fR, \fBchtype\fR \fIch\fR);
.fi

.LP
.nf
\fBint\fR \fBmvwaddch\fR(\fBWINDOW *\fR\fIwin\fR, \fBint\fR \fIy\fR, \fBint\fR \fIx\fR, \fBchtype\fR \fIch\fR);
.fi

.LP
.nf
\fBint\fR \fBechochar\fR(\fBchtype\fR \fIch\fR);
.fi

.LP
.nf
\fBint\fR \fBwechochar\fR(\fBWINDOW *\fR\fIwin\fR, \fBchtype\fR \fIch\fR);
.fi

.SH DESCRIPTION
.sp
.LP
With the \fBaddch()\fR, \fBwaddch()\fR, \fBmvaddch()\fR, and \fBmvwaddch()\fR
routines, the character \fIch\fR is put into the window at the current cursor
position of the window and the position of the window cursor is advanced. Its
function is similar to that of \fBputchar()\fR. At the right margin, an
automatic newline is performed. At the bottom of the scrolling region, if
\fBscrollok()\fR is enabled, the scrolling region is scrolled up one line.
.sp
.LP
If \fIch\fR is a tab, newline, or backspace, the cursor is moved appropriately
within the window. A newline also does a \fBclrtoeol()\fR before moving. Tabs
are considered to be at every eighth column. If \fIch\fR is another control
character, it is drawn in the \fB^\fR\fIX\fR notation. Calling \fBwinch()\fR
after adding a control character does not return the control character, but
instead returns the representation of the control character. See
\fBcurs_inch\fR(3CURSES).
.sp
.LP
Video attributes can be combined with a character by OR-ing them into the
parameter. This results in these attributes also being set. (The intent here is
that text, including attributes, can be copied from one place to another using
\fBinch()\fR and \fBaddch()\fR.) (see \fBstandout()\fR, predefined video
attribute constants, on the \fBcurs_attr\fR(3CURSES) page).
.sp
.LP
The \fBechochar()\fR and \fBwechochar()\fR routines are functionally equivalent
to a call to \fBaddch()\fR followed by a call to \fBrefresh()\fR, or a call to
\fBwaddch\fR followed by a call to \fBwrefresh()\fR. The knowledge that only a
single character is being output is taken into consideration and, for
non-control characters, a considerable performance gain might be seen by using
these routines instead of their equivalents.
.SS "Line Graphics"
.sp
.LP
The following variables may be used to add line drawing characters to the
screen with routines of the \fBaddch()\fR family.  When variables are defined
for the terminal, the \fBA_ALTCHARSET\fR bit is turned on (see
\fBcurs_attr\fR(3CURSES)). Otherwise, the default character listed below is
stored in the variable. The names chosen are consistent with the VT100
nomenclature.
.sp

.sp
.TS
box;
c | c | c
l | l | l .
Name	Default	Glyph Description
_
ACS_ULCORNER	+	upper left-hand corner
_
ACS_LLCORNER	+	lower left-hand corner
_
ACS_URCORNER	+	upper right-hand corner
_
ACS_LRCORNER	+	lower right-hand corner
_
ACS_RTEE	+	right tee
_
ACS_LTEE	+	left tee
_
ACS_BTEE	+	bottom tee
_
ACS_TTEE	+	top tee
_
ACS_HLINE	-	horizontal line
_
ACS_VLINE	|	vertical line
_
ACS_PLUS	+	plus
_
ACS_S1	-	scan line 1
_
ACS_S9	-	scan line 9
_
ACS_DIAMOND	+	diamond
_
ACS_CKBOARD	:	checker board (stipple)
_
ACS_DEGREE	\&'	degree symbol
_
ACS_PLMINUS	#	plus/minus
_
ACS_BULLET	o	bullet
_
ACS_LARROW	<	arrow pointing left
_
ACS_RARROW	>	arrow pointing right
_
ACS_DARROW	v	arrow pointing down
_
ACS_UARROW	^	arrow pointing up
_
ACS_BOARD	#	board of squares
_
ACS_LANTERN	#	lantern symbol
_
ACS_BLOCK	#	solid square block
.TE

.SH RETURN VALUES
.sp
.LP
All routines return the integer \fBERR\fR upon failure and an integer value
other than \fBERR\fR upon successful completion.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
MT-Level	Unsafe
.TE

.SH SEE ALSO
.sp
.LP
.BR putc (3C),
.BR curs_attr (3CURSES),
.BR curs_clear (3CURSES),
.BR curs_inch (3CURSES),
.BR curs_outopts (3CURSES),
.BR curs_refresh (3CURSES),
.BR curses (3CURSES),
.BR attributes (7)
.SH NOTES
.sp
.LP
The header <\fBcurses.h\fR> automatically includes the headers  <\fBstdio.h\fR>
and <\fBunctrl.h\fR>.
.sp
.LP
Note that \fBaddch()\fR, \fBmvaddch()\fR, \fBmvwaddch()\fR, and
\fBechochar()\fR may be macros.
